<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/assets/lib/layui/css/layui.css" />
    <link rel="stylesheet" href="../../assets/lib/cropper/cropper.css" />
    <link rel="stylesheet" href="/assets/css/article/art_edit.css" />
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">修改文章</div>
        <div class="layui-card-body">
            <!-- 修改文章的表单 -->
            <form class="layui-form" lay-filter="addArticle" id="formAddArticle" enctype="multipart/form-data">
                <!-- 文章标题 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">文章标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" />
                    </div>
                </div>
                <!-- 文章类别 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">文章类别</label>
                    <div class="layui-input-block" id="art_cate"></div>
                </div>
                <!-- 文章内容 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">文章内容</label>
                    <div class="layui-input-block" style="height: 400px;">
                        <textarea name="content" id="content"></textarea>
                    </div>
                </div>
                <!-- 文章封面 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">文章封面</label>
                    <div class="layui-input-block cropper-container">
                        <!-- 文件选择框 -->
                        <input type="file" id="fileCover" accept="image/jpeg,image/png,image/gif,image/bmp" style="display: none;" />
                        <div class="cropper-box">
                            <img id="image" src="">
                        </div>

                        <div class="right-box">
                            <div class="img-preview"></div>
                            <button class="layui-btn layui-btn-danger" id="btnChooseCoverImage">选择封面</button>
                        </div>
                    </div>
                </div>
                <!-- 按钮区域 -->
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit id="btnPublish">发布</button>
                        <button class="layui-btn layui-btn-primary" lay-submit id="btnSave">存为草稿</button>
                    </div>
                </div>
                <input type="hidden" name="Id" />
            </form>
        </div>
    </div>

    <!-- 文章分类列表的模板 -->
    <script type="text/html" id="selectArtCates">
        <select name="cate_id" lay-verify="required">
        <option value="">请选择文章类别</option>
        {{each data}}
        <option value="{{$value.Id}}">{{$value.name}}</option>
        {{/each}}
      </select>
    </script>

    <script src="/assets/lib/layui/layui.all.js"></script>
    <script src="/assets/lib/template-web.js"></script>
    <script src="/assets/lib/jquery.js"></script>
    <script src="/assets/js/baseAPI.js"></script>
    <!-- 富文本编辑器 -->
    <script src="../../assets/lib/tinymce/tinymce.min.js"></script>
    <script src="../../assets/lib/tinymce/tinymce_setup.js"></script>
    <!-- 图片裁剪 -->
    <script src="../../assets/lib/cropper/Cropper.js"></script>
    <script src="../../assets/lib/cropper/jquery-cropper.js"></script>
    <script src="/assets/js/article/art_edit.js"></script>
</body>

</html>